/**
 *@file main.cpp
 *@author lynsdk team
 *@version v1.0
 *@date 2022-09-23
 *@par Copyright:
 *© 2018 北京灵汐科技有限公司 版权所有。\n
 * 注意：以下内容均为北京灵汐科技有限公司原创，未经本公司允许，不得转载，否则将视为侵权；对于不遵守此声明或者其他违法使用以下内容者，本公司依法保留追究权。\n
 *© 2018 Lynxi Technologies Co., Ltd. All rights reserved. \n
 * NOTICE: All information contained here is, and remains the property of Lynxi.
 *This file can not be copied or distributed without the permission of Lynxi
 *Technologies Co., Ltd.
 *@brief This file describes the sample for using interfaces of smi
 */

#include <lyn_api.h>
#include <unistd.h>
#include <iostream>
#include "lyn_smi.h"
#include "util.hpp"
#include "CLI/CLI11.hpp" // 引入 CLI11 头文件

using namespace std;

int main(int argc, char *argv[]) {
  CLI::App app;
  int deviceId = 0;
  // 添加选项
  app.add_option("-d", deviceId, "lynxi device id. eg.:0")->default_val(0);

  CLI11_PARSE(app, argc, argv);

  // 获取板卡版本号信息
  lynDriverVersionS_t driverVersion;
  int err = lynGetDriverVersionS(&driverVersion);

  if (0 != err) {
    std::cout << "lynGetDriverVersions failed" << std::endl;
  } else {
    std::cout << "driverVersion:" << driverVersion.driverVersion << std::endl;
  }

  // 获取芯片参数信息
  lynDeviceProperties_t deviceProp;
  err = lynGetDeviceProperties(deviceId, &deviceProp);
  if (0 != err) {
    std::cout << "lynGetDeviceProperties failed" << std::endl;
  } else {
    std::cout << "chip " << deviceId << " boardPowerDraw :" << deviceProp.boardPowerDraw / 1000 << "W" << std::endl;
  }

  return 0;
}
